/*****************************************************************************
* hashcode.cpp: hash code compuation
*****************************************************************************
* not a part of orignial x264
* written by jinlei in 2011
*****************************************************************************/
#include <boost/functional/hash/hash.hpp>

#include "hashcode.h"
unsigned short* get_hash_code(unsigned int* hash_code_table_pre, unsigned int* hash_code_table, 
							  unsigned char* src,int i_mb_xy, int i_mb_width, int i_mb_height, int b_change,
							  unsigned int* call_times){
	unsigned short* hash_code_arr;
	unsigned int hash_code;
	if(b_change){
		(*call_times)++;
		hash_code=boost::hash_range(src, src+i_mb_width*i_mb_height);
		hash_code_table[i_mb_xy]=hash_code;
	}
	else{
		hash_code_table[i_mb_xy]=hash_code_table_pre[i_mb_xy];
	}
	hash_code_arr=(unsigned short*) &hash_code_table[i_mb_xy];
	return hash_code_arr;
}